package com.benmei.ntlive.dto.ntmsg.cons;

/**
 * Created by Peter on 2017/11/21.
 *
 * zh-cn（简体中文）、en-us（英语-美国）
 *
 */
public enum ClientLanguage {
    zh_cn("zh-cn"),

    en_us("en-us");

    private final String name;

    ClientLanguage(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public static boolean validate(String name) {
        boolean result = false;
        for (ClientLanguage role : ClientLanguage.values()) {
            if (role.getName().equals(name)) {
                result = true;
                break;
            }
        }
        return result;
    }

    public static ClientLanguage getByName(String name) {
        for (ClientLanguage o : ClientLanguage.values()) {
            if (o.name == name) {
                return o;
            }
        }
        return null;
    }
}
